package com.gjs.freechat.server.component.bean;

public class ChatSession {

	private String id;
	private int type;
	private String leftUserId;
	private String rightUserId;
	private String friendRequestSender;
	
	public ChatSession(String id, int type, String leftUserId, String rightUserId) {
		this.id = id;
		this.type = type;
		this.leftUserId = leftUserId;
		this.rightUserId = rightUserId;
	}
	
	public ChatSession() {}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getLeftUserId() {
		return leftUserId;
	}
	public void setLeftUserId(String leftUserId) {
		this.leftUserId = leftUserId;
	}
	public String getRightUserId() {
		return rightUserId;
	}
	public void setRightUserId(String rightUserId) {
		this.rightUserId = rightUserId;
	}
	
	
	public String getFriendRequestSender() {
		return friendRequestSender;
	}

	public void setFriendRequestSender(String friendRequestSender) {
		this.friendRequestSender = friendRequestSender;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ChatSession chatSession = (ChatSession) obj;
		if (leftUserId != null && rightUserId != null) {
			return (leftUserId.equals(chatSession.getLeftUserId()) && rightUserId.equals(chatSession.getRightUserId()))
					|| (leftUserId.equals(chatSession.getRightUserId()) && rightUserId.equals(chatSession.getLeftUserId()));
		} else {
			return false;
		}
	}
	
}
